<?php

/** 
* 
* 
* by:南宁火蝶科技有限公司 http:///www.HdsysCms.com
* 声明:本系统禁止用二次开发、侵犯HdsysCms著作和除去HdsysCms进行售卖,如发现将追究一切权利,模版制作属于自己所得可以通过本系统对外开发模版获取收益!
* 
* 2019年第一版本发布 - 到2023.9.1开源使用! 
* php混淆工具:phpencry.wbox.top
* 
* 注意防骗:@HdsysCms 官方没授权任何个人机构合作,唯一收款抬头:《南宁火蝶科技有限公司》和官网显示客服唯一渠道客服,其它渠道以HdsysCms名义行为均骗子!
*
*/
	

function adminechohtnl()
{
echo '<script src="' . getcdnurlhost() . '/g.js?2022-12-11-1"></script>';
echo " <style> .code-show{ margin-right: 5px;</style>";
if (bs_lib::get_configs_value('personality', 'en')==1) {
} else {
echo "<style> .en-hide{display: none !important;}</style>";
}
}
function call_my_is_https()
{
$__SERVER__=call_my_SERVER();
if (!empty($__SERVER__['HTTPS']) && strtolower($__SERVER__['HTTPS']) !=='off') {
return true;
} elseif (isset($__SERVER__['HTTP_X_FORWARDED_PROTO']) && $__SERVER__['HTTP_X_FORWARDED_PROTO']==='https') {
return true;
} elseif (!empty($__SERVER__['HTTP_FRONT_END_HTTPS']) && strtolower($__SERVER__['HTTP_FRONT_END_HTTPS']) !=='off') {
return true;
} elseif (isset($__SERVER__['HTTP_X_CLIENT_SCHEME']) && $__SERVER__['HTTP_X_CLIENT_SCHEME']=='https') {
return true;
}
return false;
}
function getsysurl()
{
$__SERVER__=call_my_SERVER();
if (call_my_is_https()) {
$param_sys_protocal="https" . ":" . "/" . "/";
} else {
$param_sys_protocal="http" . ":" . "/" . "/";
}
$param_php_self=__DIR__;
$param_php_self=call_my_str_replace('\\', '/', $param_php_self);
$param_dOCUMENT_ROOT=$__SERVER__['DOCUMENT_ROOT'];
$param_dOCUMENT_ROOT=call_my_str_replace('\\', '/', $param_dOCUMENT_ROOT);
$param_php_self=call_my_str_replace('LibHdSys/common', '', $param_php_self);
$param_php_self=call_my_str_replace($param_dOCUMENT_ROOT, '', $param_php_self);
$param_arr=call_my_explode('/', $param_dOCUMENT_ROOT);
foreach ($param_arr as &$param_vd) {
if ($param_vd !='') {
$param_php_self=intelligence_replace_once("/{$param_vd}", '', $param_php_self);
}
}
return $param_sys_protocal . (isset($__SERVER__['HTTP_HOST']) ? $__SERVER__['HTTP_HOST'] : '') . $param_php_self;
}
function intelligence_replace_once($param_needle, $param_replace, $param_haystack)
{
$param_pos=strpos($param_haystack, $param_needle);
if ($param_pos===false) {
return $param_haystack;
}
return substr_replace($param_haystack, $param_replace, $param_pos, strlen($param_needle));
}
function getroomdir()
{
$__SERVER__=call_my_SERVER();
if (call_my_is_https()) {
$param_sys_protocal="https" . ":" . "/" . "/";
} else {
$param_sys_protocal="http" . ":" . "/" . "/";
}
$param_php_self=__DIR__;
$param_dOCUMENT_ROOT=$__SERVER__['DOCUMENT_ROOT'];
$param_php_self=call_my_str_replace('/LibHdSys/common', '', $param_php_self);
$param_php_self=call_my_str_replace('\LibHdSys\common', '', $param_php_self);
$param_php_self=call_my_str_replace($param_dOCUMENT_ROOT, '', $param_php_self);
return  $param_php_self;
}
function isadminlogin()
{
get_session_value('admin_user');
$param_admin_id=get_session_value('admin_id');
$param_admin_user=get_session_value('admin_user');
$param_admin_md5=get_session_value('admin_md5');
$param_db=bs_lib::load_libhdsys_class('db');
$param_param_tmp="SELECT * FROM `hdsys_admin` WHERE `username` LIKE '{$param_admin_user}'";
$param_userarr=$param_db->intelligence_array($param_param_tmp);
if (!$param_userarr) {
call_alert_location('请登录再继续', 'index.php?m=manage&c=admin&a=login');
exit;
}
$param_call_my_md5=call_my_md5($param_admin_id . $param_userarr['username'] . $param_userarr['password'] . 'NanNingHuoDieKeJi');
if ($param_call_my_md5==$param_admin_md5) {
} else {
call_alert_location('请登录再继续', 'index.php?m=manage&c=admin&a=login');
exit;
}
}
function read_dir($param_dir)
{
$param_files=array();
$param_dir_list=scandir($param_dir);
foreach ($param_dir_list as $param_file) {
if ($param_file !='..' && $param_file !='.') {
if (is_dir($param_dir . '/' . $param_file)) {
$param_files2=read_dir($param_dir . '/' . $param_file);
$param_files=array_merge($param_files, $param_files2);
} else {
$param_files[]=$param_dir . '/' . $param_file;
}
}
}
return $param_files;
}
function call_my_read_dir_file($param_dir)
{
$param_files=array();
$param_dir_list=scandir($param_dir);
foreach ($param_dir_list as $param_file) {
if ($param_file !='..' && $param_file !='.') {
if (is_dir($param_dir . '/' . $param_file)) {
$param_files[]=$param_dir . '/' . $param_file;
} else {
$param_files[]=$param_dir . '/' . $param_file;
}
}
}
return $param_files;
}
function del_cache()
{
$param_dir=HDSYS_DIR_SYS . 'cache';
$param_dir_list=read_dir($param_dir);
if (new_is_writeable($param_dir)==false) {
return false;
}
foreach ($param_dir_list as $param_file) {
$param_file_show=str_replace(HDSYS_DIR_SYS, '@', $param_file);
if (is_file($param_file)) {
@unlink($param_file);
}
}
}
function admin_url()
{
$__SERVER__=call_my_SERVER();
if (call_my_is_https()) {
$param_sys_protocal="https" . ":" . "/" . "/";
} else {
$param_sys_protocal="http" . ":" . "/" . "/";
}
$param_php_self=$__SERVER__['PHP_SELF'];
$param_php_self=call_my_str_replace('index.php', '', $param_php_self);
return $param_sys_protocal . (isset($__SERVER__['HTTP_HOST']) ? $__SERVER__['HTTP_HOST'] : '') . $param_php_self;
}
function admin_index_url()
{
$__SERVER__=call_my_SERVER();
if (call_my_is_https()) {
$param_sys_protocal="https" . ":" . "/" . "/";
} else {
$param_sys_protocal="http" . ":" . "/" . "/";
}
$param_php_self=$__SERVER__['PHP_SELF'];
$param_php_self=call_my_str_replace('index.php', '', $param_php_self);
$param_arr=call_my_explode('/', $param_php_self);
$param_php_self=call_my_str_replace($param_arr[count($param_arr) - 2] . '/', '', $param_php_self);
return $param_sys_protocal . (isset($__SERVER__['HTTP_HOST']) ? $__SERVER__['HTTP_HOST'] : '') . $param_php_self;
}
function htmltolashes($param_y, $param_a='')
{
$param_y=call_my_str_replace("'", '&#039;', $param_y);
$param_y=call_my_str_replace("<?", "<\?", $param_y);
return $param_y;
}
function phptagetolashes($param_y, $param_a='')
{
$param_y=call_my_str_replace("<?", '&gt;?', $param_y);
$param_y=call_my_str_replace("&#039;", "'", $param_y);
return $param_y;
}
function ArrayToCodeFile($param_array)
{
$param_Array_ToCodeFile_3w=call_my_Array_ToCodeFile_3w($param_array);
$param_code_array_php="<?php   return $param_Array_ToCodeFile_3w ;";
return $param_code_array_php;
}
function call_my_Array_ToCodeFile_3w($param_array)
{
$param_code_array_php="array(";
foreach ($param_array as $param_value=> $param_key) {
if (is_array($param_key)==true) {
$param_key=call_my_Array_ToCodeFile_3w($param_key);
$param_code_array_php .="\"$param_value\"=>$param_key,";
} else {
$param_y=addslashes($param_key);
$param_y=call_my_str_replace('$', '\$', $param_y);
$param_code_array_php .="\"$param_value\"=>\"$param_y\",";
}
}
$param_code_array_php .=')';
return $param_code_array_php;
}
